package com.java8.ch06;

/**
 * Here,Box uses a parameterized constructor to initialize the dimensions of a
 * box.
 * 
 * @author Administrator
 *
 */
public class BoxDemo7 {

	public static void main(String[] args) {
		Box7 mybox1 = new Box7(10, 20, 30);
		Box7 mybox2 = new Box7(3, 6, 9);
		// get Volume
		System.out.println("Mybox1's Volume is " + mybox1.volume());
		System.out.println("Mybox2's Volume is " + mybox2.volume());
	}
}

class Box7 {

	double width;
	double height;
	double depth;

	// This is the constructor for Box.
	public Box7(double w, double h, double d) {
		width = w;
		height = h;
		depth = d;
	}

	// compute and return volume of a box
	double volume() {
		return width * height * depth;
	}

}